import React from 'react';
import { createBrowserRouter } from 'react-router-dom';

import MainLayout from '../Layouts/MainLayout/Index';
import ManageLayout from '../Layouts/ManageLayout/Index';
import QuestionLayout from '../Layouts/QuestionLayout/Index';
import Home from '../pages/Home';
import Login from '../pages/Login';
import Register from '../pages/Register';
import ManageList from '../pages/Manage/List';
import ManageStar from '../pages/Manage/Star';
import ManageTrash from '../pages/Manage/Trash';
import NotFound from '../pages/NotFound';

import Edit from '../pages/Question/Edit/Index';
import Stat from '../pages/Question/Stat/Index';

const routes: Array<object> = [
    {
        path: '/login',
        element: <Login />,
    },
    {
        path: '/register',
        element: <Register />,
    },
    {
        path: '/',
        element: <MainLayout />,
        children: [
            {
                path: '/',
                element: <Home />,
            },
            {
                path: 'manage',
                element: <ManageLayout />,
                children: [
                    {
                        path: 'list',
                        element: <ManageList />,
                    },
                    {
                        path: 'star',
                        element: <ManageStar />,
                    },
                    {
                        path: 'trash',
                        element: <ManageTrash />,
                    },
                ],
            },
        ],
    },
    {
        path: 'question',
        element: <QuestionLayout />,
        children: [
            {
                path: 'edit/:id',
                element: <Edit />,
            },
            {
                path: 'stat/:id',
                element: <Stat />,
            },
        ],
    },
    {
        path: '*',
        element: <NotFound />,
    },
];
const router = createBrowserRouter(routes);
console.log(router);

export default router;
